<? if(isset($_REQUEST["active"])){ ?>
<script>
	$(function() {
		$("#configs").accordion('activate', <? echo $_REQUEST["active"]; ?>);
	});
</script>
<? } ?>
<div id='configs'>
	<h3><a href="#">Groupes</a></h3>
	<div>
		<table style='width: 100%;' cellspacing='0' cellpadding='0' class='ui-corner-all ui-widget-content'>
			<tr>
				<td style='width: 220px; vertical-align: top; border-right: 1px solid #999999; padding-top: 5px; padding-bottom: 5px;'>
					<table id='groupesliste' cellspacing='0' cellpadding='1' style='width: 100%; border-top: 1px solid #000000;'>
						<? $res=$sql->request("select * from ".CFG_MYSQL_PREFIX."groupe order by nom");
						$i=0;
						foreach($res as $var){ ?>
						<tr>
							<td id='G<? echo $var->id; ?>' class='ui-state-default' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' style='width: 10px; padding-left: 2px; border-width: 0px; border-bottom: 1px solid #000000; border-right: 1px solid #AAAAAA; cursor: pointer;' onclick="$('#dialog').attr('idGroupe',$(this).attr('id')); open_dialog('Supprimer un groupe', 'Etes-vous sur de vouloir supprimer ce groupe?', { 'Non': function() { $(this).dialog('close'); }, 'Oui': function() { document.getElementById('formGroupesSupprimerGroupe'+$(this).attr('idGroupe')).submit(); $(this).dialog('close'); open_loading(); } });">
								<span class="ui-icon ui-icon-circle-close tooltip" title='Supprimer ce groupe'></span>
								<form name='formGroupesSupprimerGroupeG<? echo $var->id; ?>' id='formGroupesSupprimerGroupeG<? echo $var->id; ?>' action='' method='post'>
									<input type='hidden' name='id' value='<? echo $var->id; ?>' />
									<input type='hidden' name='action' value='supprimer_groupe' />
								</form>
							</td>
							<td class='ui-state-default' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' style='padding-left: 5px; cursor: pointer; border-width: 0px 0px 1px 0px;' onclick='groupesLoadUsers(<? echo $var->id; ?>,this);'><? echo $var->nom; ?></td>
						</tr>
						<? $i++; } ?>
					</table>
					<br />
					<form name="formGroupesAjouterGroupe" action='' method='post' class='align-center'>
						<? show_error("formGroupesAjouterGroupe"); ?>
						<table style='margin: auto;'>
							<tr>
								<td><input type='text' name='nomGroupe' /></td>
								<td><div class='div-icon ui-state-default ui-corner-all pointer tooltip' title='Ajouter ce groupe' onclick='open_loading(); document.formGroupesAjouterGroupe.submit();'><span class="ui-icon ui-icon-circle-plus"></span></div></td>
							</tr>
						</table>
						<input type='hidden' name='action' value='ajouter_groupe' />
					</form>
				</td>
				<td style='vertical-align: top; text-align: center;' id='tdGroupes'>
					&nbsp;
				</td>
			</tr>
		</table>
	</div>
	<h3><a href="#">Droits d'accès</a></h3>
	<div>
		<table style='width: 100%;' cellspacing='0' cellpadding='0' class='ui-corner-all ui-widget-content'>
			<tr>
				<td style='width: 220px; vertical-align: top; border-right: 1px solid #999999; padding-top: 5px; padding-bottom: 5px;'>
					<table id='droitsliste' cellspacing='0' cellpadding='1' style='width: 100%; border-top: 1px solid #000000;'>
						<? $res=$sql->request("select * from ".CFG_MYSQL_PREFIX."module where actif=1 and menuSite=1 order by nomComplet");
						$i=0;
						foreach($res as $var){ ?>
						<tr>
							<td class='ui-state-default' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' style='padding-left: 5px; cursor: pointer; border-width: 0px 0px 1px 0px;' onclick='droitsLoad("<? echo $var->nom; ?>",this);'><? echo $var->nomComplet; ?></td>
						</tr>
						<? $i++; }
						$res=$sql->request("select * from ".CFG_MYSQL_PREFIX."module where actif=1 and menuAdmin=1 order by nomComplet");
						$i=0;
						foreach($res as $var){ ?>
						<tr>
							<td class='ui-state-default' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' style='padding-left: 5px; cursor: pointer; border-width: 0px 0px 1px 0px;' onclick='droitsLoad("<? echo "admin-".$var->nom; ?>",this);'>Admin - <? echo $var->nomComplet; ?></td>
						</tr>
						<? $i++; } ?>
						<tr>
							<td class='ui-state-default' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' style='padding-left: 5px; cursor: pointer; border-width: 0px 0px 1px 0px;' onclick='droitsLoad("admin-configuration",this);'>Admin - Configuration</td>
						</tr>
					</table>
				</td>
				<td style='vertical-align: top; text-align: center;' id='tdDroits'>
					&nbsp;
				</td>
			</tr>
		</table>
	</div>
	<h3><a href="#">Guilde</a></h3>
	<div>
		<form name='formAdminConfigurationGuilde' action='' method='post'>
			<table style='width: 100%;' cellspacing='0' cellpadding='2' class='ui-corner-all ui-widget-content'>
				<tr class='tr1'>
					<td style='width: 250px;'>Nom de la guilde</td>
					<td>
						<input type='text' name='CFG_GUILDE' value='<? echo CFG_GUILDE; ?>' />
					</td>
				</tr>
				<tr class='tr2'>
					<td>Serveur</td>
					<td>
						<select name='CFG_SERVEUR'>
							<option value='eu' <? if(CFG_SERVEUR=='eu') echo "selected='selected'"; ?>>Europe</option>
							<option value='us' <? if(CFG_SERVEUR=='us') echo "selected='selected'"; ?>>Etats Unis</option>
							<option value='kr' <? if(CFG_SERVEUR=='kr') echo "selected='selected'"; ?>>Korée</option>
							<option value='cn' <? if(CFG_SERVEUR=='cn') echo "selected='selected'"; ?>>Chine</option>
							<option value='tw' <? if(CFG_SERVEUR=='tw') echo "selected='selected'"; ?>>Taiwan</option>
						</select>
					</td>
				</tr>
				<tr class='tr1'>
					<td>Royaume</td>
					<td>
						<input type='text' name='CFG_ROYAUME' value='<? echo CFG_ROYAUME; ?>' />
					</td>
				</tr>
			</table>
			<br />
			<div class='align-center'><a href="#" onclick="open_loading(); document.formAdminConfigurationGuilde.submit();" class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-disk"></span>Enregistrer</a></div>
			<br />
			<input type='hidden' name='action' value='enregistrer_configuration' />
			<input type='hidden' name='active' value='2' />
		</form>
	</div>
	<h3><a href="#">Apparence</a></h3>
	<div>
		<form name='formAdminConfigurationApparence' action='' method='post'>
			<table style='width: 100%;' cellspacing='0' cellpadding='2' class='ui-corner-all ui-widget-content'>
				<tr class='tr1'>
					<td style='width: 250px;'>Thème</td>
					<td>
						<select name='CFG_THEME'>
							<? if(is_dir('themes')){
								$handle=opendir('themes');
								while(false!==($file=readdir($handle))){
									if((is_dir('themes/'.$file))&&($file!='.')&&($file!='..')){
										if(CFG_THEME==$file) echo "<option selected='selected'>".$file."</option>";
										else echo "<option>".$file."</option>";
									}
								}
							} ?>
						</select>
					</td>
				</tr>
				<tr class='tr2'>
					<td>Titre des pages</td>
					<td>
						<input type='text' name='CFG_TITRE_PAGE' value='<? echo CFG_TITRE_PAGE; ?>' />
					</td>
				</tr>
			</table>
			<br />
			<div class='align-center'><a href="#" onclick='open_loading(); document.formAdminConfigurationApparence.submit();' class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-disk"></span>Enregistrer</a></div>
			<br />
			<input type='hidden' name='action' value='enregistrer_configuration' />
			<input type='hidden' name='active' value='3' />
		</form>
	</div>
	<h3><a href="#">Identification</a></h3>
	<div>
		<form name='formAdminConfigurationIdent' action='' method='post'>
			<table style='width: 100%;' cellspacing='0' cellpadding='2' class='ui-corner-all ui-widget-content'>
				<? $res=$sql->request("select * from ".CFG_MYSQL_PREFIX."module where type='ident' and actif=1");
				$i=0;
				foreach($res as $var){ ?>
				<tr class='tr<? echo ($i%2)+1; ?>'>
					<td style='width: 10px;'><input type='radio' name='CFG_IDENT' value='<? echo $var->nom; ?>' <? if(CFG_IDENT==$var->nom) echo "checked='checked'"; ?> /></td>
					<td>
						<b><? echo $var->nomComplet; ?></b><br />
						<? echo $var->description; ?>
					</td>
				</tr>
				<? $i++; } ?>
			</table>
			<br />
			<div class='align-center'><a href="#" onclick='open_loading(); document.formAdminConfigurationIdent.submit();' class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-disk"></span>Enregistrer</a></div>
			<br />
			<input type='hidden' name='action' value='enregistrer_configuration' />
			<input type='hidden' name='active' value='4' />
		</form>
	</div>
	<h3><a href='#'>Modules</a></h3>
	<div>
		<form name='formAdminModules' action='' method='post'>
			<table style='width: 100%;' cellspacing='0' cellpadding='2' class='ui-corner-all ui-widget-content'>
				<tr>
					<td class='th1'>Actif</th>
					<td class='th1' style='width: 120px;'>Nom</th>
					<td class='th1' style='width: 240px;'>Nom complet</th>
					<td class='th1' style='width: 100px;'>Auteur</th>
					<td class='th1' style='width: 50px;'>Version</td>
					<td class='th1'>Dépendance</th>
					<td class='th1'>Implémente</th>
				</tr>
				<? $i=1;
				foreach($modules_admin as $module_admin){ ?>
					<tr class='tr<? echo ($i%2)+1; ?>'>
						<td style='width: 20px;'>
							<? if(!$module_admin["install"]){ ?>
								<div class='div-icon ui-state-default ui-corner-all pointer tooltip' title='Installer ce module'><span class="ui-icon ui-icon-wrench"></span></div>
							<? }else{
								$dep=$module_admin["module"]->check_dependance();
								if($dep==""){
									if($module_admin["install"]&&!$module_admin["core"]){ ?><input type='hidden' name='chk_<? echo $module_admin["module"]->get_nom(); ?>' value='0' /><? } ?>
								<input class='tooltip' name='chk_<? echo $module_admin["module"]->get_nom(); ?>' type='checkbox' value='1' <? if($module_admin["install"]&&$module_admin["module"]->get_actif()) echo "checked='checked'"; ?> <? if($module_admin["install"]&&$module_admin["core"]) echo "disabled='disabled'"; ?> title='Activer/Désactiver ce module' />
								<? }else{
									echo $dep;
								}
							} ?>
						</td>
						<td class='<? if($module_admin["install"]&&$module_admin["core"]) echo " core"; ?>'><? echo $module_admin["nom"]; ?></td>
						<? if(isset($module_admin["module"])){ ?>
						<td class='<? if($module_admin["install"]&&$module_admin["core"]) echo " core"; ?>'><?  echo $module_admin["module"]->get_nomComplet(); ?></td>
						<td class='<? if($module_admin["install"]&&$module_admin["core"]) echo " core"; ?>'><? echo $module_admin["module"]->get_auteur(); ?></td>
						<td class='<? if($module_admin["install"]&&$module_admin["core"]) echo " core"; ?>'><? echo $module_admin["module"]->get_version(); ?></td>
						<td class='<? if($module_admin["install"]&&$module_admin["core"]) echo " core"; ?>'><? echo $module_admin["module"]->get_dependance(); ?></td>
						<td class='<? if($module_admin["install"]&&$module_admin["core"]) echo " core"; ?>'><? echo $module_admin["module"]->get_parentModule(); ?></td>
						<? }else{ ?>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<? } ?>
					</tr>
				<? $i++; } ?>
			</table>
			<br />
			<div class='align-center'><a href="#" onclick='open_loading(); document.formAdminModules.submit();' class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-disk"></span>Enregistrer</a></div>
			<br />
			<input type='hidden' name='action' value='enregistrer_modules' />
			<input type='hidden' name='active' value='5' />
		</form>
	</div>
</div>